@extends('master')

@section('content')
<div class="management-content">
    <div class="container">


        <div class="record-list">
            <button class="btn btn-primary pull-right" data-remote="/topic/create" data-toggle="modal" data-target="#topic-modal" data-action="topic-detail"><i class="glyphicon glyphicon-plus"></i> 新建专题</button>
            <span class="clearfix"></span>
          <hr class="clearfix">
           @if(Session::get('message'))
          <div class="alert alert-info" role="alert">{{ Session::get('message') }}</div>
           @endif

           @if(Session::get('error'))
          <div class="alert alert-danger" role="alert">{{ Session::get('error') }}</div>
           @endif

           @if(count($topics) != 0)
            <h2>专题管理</h2>
            <table class="table">
                <thead>
                    <tr>
                        <th class="col-sm-3">专题缩略图</th>
                        <th class="col-sm-3">标题</th>
                        <th class="col-sm-3">描述</th>
                        <th class="col-sm-3">操作</th>
                    </tr>
                </thead>
                <tbody>
                     @foreach ($topics as $topic)
                    <tr>
                        <td>
                            <img src="{{ '/uploads/topic/' . $topic->thumb }}" alt="">
                        </td>
                        <td>
                            {{ $topic->name }}
                        </td>
                        <td>
                            {{ $topic->description }}
                        </td>
                        <td>
                            <a href="javascript:void(0)" class="btn btn-sm btn-primary" data-remote="/topic/edit/{{ $topic->id }}" data-toggle="modal" data-target="#topic-modal"><i class="glyphicon glyphicon-edit"></i> 编辑</a>

                            <a href="javascript:void(0)" class="btn btn-sm btn-primary" data-remote="/topic/edit-pictures/{{ $topic->id }}" data-toggle="modal" data-target="#photo-modal"><i class="glyphicon glyphicon-picture"></i> 图片管理</a>
                            <a href="/topic/delete/{{ $topic->id }}" class="btn btn-sm btn-danger"><i class="glyphicon glyphicon-trash"></i> 删除</a>
                        </td>
                    </tr>
                     @endforeach


                </tbody>
            </table>
            @else
            <div class="alert alert-danger" role="alert">没有任何记录！</div>
            @endif


            {{ $topics->links() }}
        </div>

    </div>
</div>
@stop




